#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    int n = 0;
    scanf("%d", &n);
    int m = n;
    int a[1001] = { 0 };
    int i = 0;
    int add = 0;
    int mul = 1;
    int sum = 0;
    while (n--)
    {
        scanf("%d", &a[i]);
        add += a[i];
        mul *= a[i];
        i++;
    }
    if (add > mul)
        sum++;
    int ret = mul / add;
    int num = 0;
    for (i = 0; i < m; ++i)
    {
        if (a[i] >= ret)
        {
            num++;
        }
    }
    sum = sum + (num - 1) * (num - 2) / 2;
    printf("%d", sum);

    return 0;
}